1. Field of the Invention
The present invention relates to encoding and decoding an image, and more particularly, to encoding and decoding an image by accurately predicting a current block.
2. Description of the Related Art
In accordance with image compression standards such as Moving Picture Experts Group (MPEG)-1 standards, MPEG-2 standards, MPEG-4H.264/MPEG-4 advanced video coding (AVC) standards, a picture is divided into predetermined image processing units, for example, macro blocks to encode an image. Each macro block is encoded by performing inter prediction or intra prediction on the macro block. An optimal encoding mode is selected in consideration of a data size and a degree of distortion of an original macro block. The macro block is encoded by using the selected encoding mode.
The intra prediction is performed not by referring to a reference picture to encode current blocks, but by using values of neighboring pixels which are spatially adjacent to a current block to be encoded. The intra prediction is performed on the current block in a predetermined intra prediction direction by using the values of the neighboring pixels. Thus, a prediction block of the current block is created. Then, a residual block is created by subtracting the prediction block from the current block. Discrete cosine transformation (DCT) is performed on the residual block to create discrete cosine coefficients and the discrete cosine coefficients are quantized to create a predetermined bitstream. By encoding only the residual block, a compression rate of image encoding is improved. Various intra prediction modes may be used in accordance with a size and a prediction direction of a block on which the intra prediction is performed.
The inter prediction is a method of compressing an image by removing temporal redundancies between pictures. A representative example of the inter prediction is a motion estimation encoding method. In the motion estimation encoding method, a motion vector of a current block is estimated by using at least one reference picture. A prediction block of the current block is created in accordance with an estimation result.
In the motion estimation encoding method, the most similar block to the current block is searched in a determined detection range of the reference picture, by using a predetermined valuation function. For example, a block that has the smallest sum of absolute differences (SAD) to the current block is detected from the reference picture. The detected block is used as the prediction block of the current block. Then, as in the intra prediction, a residual block is created by subtracting the prediction block from the current block. Various sizes of blocks such as 16×16 blocks, 8×16 blocks, and 8×8 blocks may be used as basic units of motion estimation.
As described above, when intra prediction or inter prediction is performed, a residual block, created based on a prediction block, is encoded. Thus, the more similar the prediction block and a current block are, the more substantial improvement may be accomplished in a compression rate of image encoding.